home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / monitory / sysmon / include / sysmon.i < prev   
Text File  |  1995-11-19  |  6KB  |  181 lines

  1. **    sysmon.i
  2. **
  3. **    $Filename: sysmon.i $
  4. **    $Revision: 0.6 $
  5. **    $Date: 1995/11/04 14:06:58 $
  6. **
  7. *******************************************************************************
  8. **    definition of sysmon.library base and internal structures (version 0.6)
  9. *******************************************************************************
  10. **
  11. **    Copyright (c) 1995 by Etienne Vogt.
  12. **
  13.  
  14.     IFND    SYSMON_I
  15. SYSMON_I    SET    1
  16.  
  17.     IFND    EXEC_TYPES_I
  18.     INCLUDE    "exec/types.i"
  19.     ENDC    ; EXEC_TYPES_I
  20.  
  21.     IFND    EXEC_LIBRARIES_I
  22.     INCLUDE    "exec/libraries.i"
  23.     ENDC    ; EXEC_LIBRARIES_I
  24.  
  25.     IFND    DEVICES_TIMER_I
  26.     INCLUDE    "devices/timer.i"
  27.     ENDC    ; DEVICES_TIMER_I
  28.  
  29.     IFND    DOS_DATETIME_I
  30.     INCLUDE    "dos/datetime.i"
  31.     ENDC    ; DOS_DATETIME_I
  32.  
  33. * library data structure
  34. * All field in the SysmonBase structure are PRIVATE !!!
  35. * Don't access these directly as they will change in future versions.
  36. * You have been warned !!!
  37.  
  38. HASHSIZE    EQU    32
  39. HASHMASK    EQU    $f8
  40.  
  41.  STRUCTURE SysmonBase,LIB_SIZE            ; Standard lib node
  42.     UBYTE    sb_Flags            ; Some flags here
  43.     UBYTE    sb_pad                ; We are now longword aligned
  44.     APTR    sb_ExecBase            ; Pointer to exec
  45.     APTR    sb_UtilityBase            ; Pointer to utility
  46.     BPTR    sb_SegList            ; SegList BCPL pointer
  47.     APTR    sb_CurrTaskInfo            ; Current TaskInfo Structure
  48.     APTR    sb_Switch            ; Original Switch() entry point
  49.     APTR    sb_Dispatch            ; Original Dispatch() entry point
  50.     APTR    sb_AddTask            ; Original AddTask() entry point
  51.     APTR    sb_RemTask            ; Original RemTask() entry point
  52.     APTR    sb_TaskExit            ; Original ExecBase->TaskExitCode
  53.     STRUCT    sb_TimeReq,IOTV_SIZE        ; Time Request
  54.     STRUCT    sb_TempTime,EV_SIZE        ; Temporary EClock Time
  55.     STRUCT    sb_TaskFrozen,LH_SIZE        ; Frozen task list
  56.     UWORD    sb_Reserved0            ; For longword alignment
  57.     STRUCT    sb_TaskInfoHash,4*HASHSIZE    ; TaskInfo hash table
  58.     APTR    sb_FindTask            ; Original FindTask() entry point
  59.     APTR    sb_ServerEntry            ; Server process entry point
  60.     APTR    sb_ServerName            ; Server process name
  61.     APTR    sb_SyslogFile            ; SysLog file name
  62.     APTR    sb_SyslogWindow            ; Syslog Window Name
  63.     UBYTE    sb_FilePri            ; File logging priority
  64.     UBYTE    sb_WindowPri            ; Window logging priority
  65.     UBYTE    sb_ConsolePri            ; Console logging priority
  66.     UBYTE    sb_NumLogBuffers        ; Number of allocated Buffers
  67.     APTR    sb_Buffers            ; Pointer to allocated buffers
  68.     APTR    sb_DOSBase            ; Pointer to dos
  69.     APTR    sb_DateTime            ; struct DateTime used by syslog
  70.     ULONG    sb_StampPeriod            ; Period for syslog file stamp
  71.     BPTR    sb_LogWindowHandle        ; LogWindow file handle
  72.     APTR    sb_IntuitionBase        ; Pointer to intuition
  73.     ULONG    sb_LastGuru            ; Guru Meditation code after crash
  74.     APTR    sb_SyslogPort            ; Pointer to Syslog MsgPort
  75.  LABEL   SysmonBase_SIZEOF
  76.  
  77. * The TaskInfo structure contains the CPU usage information in EClock ticks.
  78. * The link pointers are private and should not be used. Use the smNextTaskInfo()
  79. * function to traverse the list.
  80. * This structure may be extended later with new fields.
  81.  
  82.  STRUCTURE TaskInfo,0
  83.     APTR    ti_Link                ; private pointer to next TaskInfo
  84.     APTR    ti_Pred                ; private pointer to previous TaskInfo
  85.     APTR    ti_Task                ; pointer to Task Control Block
  86.     ULONG    ti_DispCount            ; Task Dispatch counter
  87.     STRUCT    ti_StartTime,EV_SIZE        ; Starting EClock Time
  88.     STRUCT    ti_LaunchTime,EV_SIZE        ; Last Launch Time
  89.     STRUCT    ti_CPUTime,EV_SIZE        ; Cumulated CPU Time
  90.  LABEL    TaskInfo_SIZEOF
  91.     
  92. * This is the private structure used by smVSysLog() to communicate with the
  93. * Sysmon.server process.
  94.  
  95. SM_MAXLOGCHARS    EQU    256            ; Max bytes in SysLog message
  96.  
  97.  STRUCTURE SysLogMsg,MN_SIZE            ; Message structure
  98.     ULONG    slm_Priority            ; SysLog priority and flags
  99.     STRUCT    slm_Text,SM_MAXLOGCHARS        ; Syslog Message body
  100.  LABEL    SysLogMsg_SIZEOF
  101.  
  102. SYSMONNAME    MACRO
  103.     DC.B    'sysmon.library',0
  104.     ENDM
  105.  
  106. SERVERNAME    MACRO
  107.     DC.B    'Sysmon.server',0
  108.     ENDM
  109.  
  110. * sb_Flags bits
  111.  
  112.     BITDEF    SBF,FPU,0            ; System has a FPU
  113.     BITDEF    SBF,IDLELED,1            ; Dim power LED when CPU is idle
  114.  
  115. * Alert definitions
  116. * These are the Guru codes that sysmon.library can spit out in a panic
  117. * condition.
  118.  
  119. AN_Sysmon    EQU    $40000000    ; SubSystem ID
  120. AN_smNoTaskInfo    EQU    $C0000001    ; No TaskInfo at Dispatch() time
  121. AN_smNoTIMem    EQU    $40010002    ; No mem for TaskInfo at startup
  122. AN_smSysLogBuf    EQU    $40010003    ; No memory for syslog buffers
  123. AN_BadSysLogMsg    EQU    $40000004    ; Bad SysLogMsg received by server
  124. AO_Sysmon    EQU    $00008040    ; Alert object
  125.  
  126. * New Task States Definitions
  127. * TS_STOP is not a real state. It is used by ShowSys to identify tasks that
  128. * are stuck in a Wait(0) call, such as crashed tasks that have been suspended.
  129.  
  130. TS_FROZENW    EQU    $80        ; Frozen task that was in WAIT state
  131. TS_STOP        EQU    TS_FROZENW    ; Stopped task (Wait(0L))
  132. TS_FROZEN    EQU    $81        ; Frozen task
  133.  
  134. * SysLog priorities and flags
  135. * The priorities are similar to that used on UNIX systems. This means that
  136. * the values use the UNIX ordering that is reversed from the Amiga one.
  137. * The flags are Amiga and sysmon specifics.
  138.  
  139. LOG_EMERG    EQU    0        ; Panic condition (Guru time)
  140. LOG_ALERT    EQU    1        ; Very serious problem
  141. LOG_CRIT    EQU    2        ; Critical error
  142. LOG_ERR        EQU    3        ; General error condition
  143. LOG_WARN    EQU    4        ; Warning condition
  144. LOG_NOTICE    EQU    5        ; Noticeable event
  145. LOG_INFO    EQU    6        ; General informational event
  146. LOG_DEBUG    EQU    7        ; Debugging information
  147. LOG_PRI        EQU    $7        ; Mask for priority field
  148.  
  149. LOG_INUSE    EQU    $80000000    ; Message is in use (private !)
  150. LOG_NOHEAD    EQU    $40000000    ; Don't prepend header
  151. LOG_NOWIN    EQU    $20000000    ; Don't output to window
  152. LOG_NOFILE    EQU    $10000000    ; Don't output to file
  153.  
  154. LOGB_INUSE    EQU    31        ; Bit numbers for flags
  155. LOGB_NOHEAD    EQU    30
  156. LOGB_NOWIN    EQU    29
  157. LOGB_NOFILE    EQU    28
  158.  
  159. * Flags definitions for smHalt()
  160.  
  161.     BITDEF    HALT,REBOOT,0        ; Reboot immediately
  162.     BITDEF    HALT,REKICK,1        ; Reload kickstart on MMU-Kicked systems.
  163.  
  164. * Function LVOs    *
  165.  
  166.     INCLUDE "exec/funcdef.i"
  167.  
  168.     FUNCDEF    smGetTaskInfo
  169.     FUNCDEF    smFreeze
  170.     FUNCDEF    smUnFreeze
  171.     FUNCDEF    smSleep
  172.     FUNCDEF    smVKPrintf
  173.     FUNCDEF    smVSPrintf
  174.     FUNCDEF    smVSysLog
  175.     FUNCDEF    smFindTaskInfo
  176.     FUNCDEF    smNextTaskInfo
  177.     FUNCDEF    smHalt
  178.  
  179.    ENDC  ;SYSMON_I
  180.  
  181.